#include "app_stub.h"
#include "pub.h"

typedef void *TmrHandle;

typedef enum _eTmrStatus {
    E_TMR_INIT,
    E_TMR_RUNNING,
    E_TMR_REG,
} E_TMR_STATUS;

typedef enum _eTmrType {
    E_TMR_START,
    E_TMR_BUTT,
} E_TMR_TYPE;

typedef struct _appStubTmr {
    uint32     uiName;
    TmrHandle  phHandle;
    uint32     uiLen;
    uint32     eStatus;
    E_TMR_TYPE eType;
} AppStubTmr;

typedef struct _appStubParaCtrl {
    bool isInitial;
    bool isStartUp;
} AppStubParaCtrl;

AppStubTmr      g_appStubTmrTbl[E_TMR_BUTT];
TmrHandle       g_appStubTmrHanleTbl[E_TMR_BUTT];
AppStubParaCtrl g_appStubParaCtrl = {
    .isInitial = false,
    .isStartUp = false,
};

bool AppStubTmrHaveReg(E_TMR_TYPE type)
{
    return (type < E_TMR_BUTT) && (g_appStubTmrTbl[type].eStatus == E_TMR_REG);
}

bool AppStubTmrIsInit(E_TMR_TYPE type)
{
    return (type < E_TMR_BUTT) && (g_appStubTmrTbl[type].eStatus == E_TMR_INIT);
}

bool AppStubTmrIsRunning(E_TMR_TYPE type)
{
    return (type < E_TMR_BUTT) &&
           (g_appStubTmrTbl[type].eStatus == E_TMR_RUNNING);
}

bool AppStubTmrReg(E_TMR_TYPE type) { return false; }

void AppStubTmrLazyInit(E_TMR_TYPE type)
{
    if (g_appStubParaCtrl.isInitial) {
        return;
    }

    g_appStubParaCtrl.isInitial = true;
}
